package day14_21.day16;

import java.util.Scanner;

public class Main01 {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int count = 0;
        for (int i = 1; i < n; i++) {
            if (isPerfectNumber(i)){
                count++;
            }
        }
        System.out.println(count);
    }
    public static boolean isPerfectNumber(int num){
        int count = 0;
        for (int i = 1; i < num; i++) {
            if (num % i == 0){
                count += i;
            }
        }
        return count == num;
    }
}
